import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation

fig, ax = plt.subplots()
x=[7.07
,7.1
,6.77
,6.77
,6.77
,6.77
,6.78
,6.62
,6.41
,6.36
,6.35
,6.4
,6.4
,6.4
,6.4
,6.4
,7.07]
y=[7.78
,7.82
,8.09
,8.09
,8.09
,8.13
,8.17
,8.55
,8.7
,8.76
,8.69
,8.49
,8.49
,8.49
,8.49
,8.4
,7.78]
x1=[7.07
,7.1
,6.77
,6.77
,6.77
,6.77
,6.78
,6.62
,6.4453
,6.2736
,6.1051
,5.9403
,5.7798
,5.6238
,5.4728
,5.327]
y1=[7.78
,7.82
,8.09
,8.09
,8.09
,8.13
,8.17
,8.55
,8.936
,9.299
,9.651
,9.99
,10.317
,10.629
,10.927
,11.21]
num_t=0
xdata, ydata = [], []
x1data, y1data = [], []
#l = ax.plot(x, y,'red')

ln, = ax.plot([], [], '.', animated=False)

def init():
    ax.set_xlim(0, 15)
    ax.set_ylim(0, 15)
    return ln,

def update(frame):
    global num_t
    print(frame)
    print(y[num_t])
    a=y[num_t]
    b1=x1[num_t]
    c1=y1[num_t]
    x1data.append(b1)
    y1data.append(c1)
    xdata.append(frame)
    ydata.append(a)
    num_t = num_t+1
    ln.set_data(xdata, ydata)
    #ln.set_data(x1data, y1data)
    return ln,

ani = FuncAnimation(fig, update, frames=x,
                    init_func=init, blit=True)
# plt.plot(x,y,label="gt",color="blue",linestyle="--")

# plt.plot(x1,y1,label="pre",color="red",linestyle="--")                   
plt.show()
